package edu.sctu.jarime.june.day20150614.OutAndInStream;

import java.io.*;

/**
 * Created by user19 on 2015/6/14.
 */
public class OutAndIn{
    public static void main(String[] args) {
        OutAndIn outAndIn= new OutAndIn();
        try {
            outAndIn.out("D://lili//ll.txt");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    public void out(String path_name)throws Exception{
        ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(path_name));
        Students students= new Students("李莉","1406101043",18);
        outputStream.writeObject(students);
        outputStream.flush();
        outputStream.close();
    }
    public void in(String path_name)throws Exception{
        ObjectInputStream inputStream = new ObjectInputStream( new FileInputStream(path_name));
        Students students=(Students)inputStream.readObject();
        System.out.println(students);
        inputStream.close();

    }
}
